<script type="text/javascript" language="javascript" charset="utf-8">
// <![CDATA[
    function _submit_perms(acl_id)
    {
        var cb = $('acl_cb_'+acl_id);
        if ( cb.checked )
        {
            access = 1;
        } else {
            access = 0;
        }


        cb.value = access;
        var params = Form.serialize($('acl_form_'+acl_id))
        new Ajax.Request('<?php echo url_for(array('controller'=>'admin/access','action'=>'modify_user_access')) ?>',
                         {parameters:params});

    }
// ]]>
</script>
<?php

    if ( is_array($all_acls) )
    {
        $odd_or_even = 0;
        foreach( $all_acls as $acl )
        {
            $odd_or_even = 1 - $odd_or_even;
            echo "<div class='acl alt{$odd_or_even}' id='acl_div_{$acl['id']}'>";
            echo form_tag('',
                            array(
                                'id'=>"acl_form_{$acl['id']}",
                                'onsubmit'=>'return false;'
                                 )
                            );
            echo hidden_field_tag('user_id',$user['id']);
            echo hidden_field_tag('acl_id',$acl['id']);

            $roptions = array(
                           'onclick'=>"_submit_perms('{$acl['id']}');",
                           'id'     =>"acl_cb_{$acl['id']}"
                           );                                        
            if ( in_array($acl['id'], $user_acls) )
            {
                $checked = true;            
            } else {
                $checked = false;
            }  
            echo check_box_tag('access',1,$checked,$roptions);
            echo $acl['acl_name'];
            echo end_form_tag();
            echo "</div>";
        }
    }

?>